home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / NeXT-Icons / next-icon@gun.com / Apps / ImagePortfolio / threads.subproj / nonBusyMutex.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-03  |  1.6 KB  |  46 lines

  1. // -------------------------------------------------------------------------------------
  2. // nonBusyMutex.h
  3. // -------------------------------------------------------------------------------------
  4. #import <mach/cthreads.h>
  5. #import <stdio.h>
  6.  
  7. // -------------------------------------------------------------------------------------
  8. // redefined mutex routines
  9. #define    mutexAlloc            nb_mutex_alloc
  10. #define    mutexInit            nb_mutex_init
  11. #define    mutexClear            nb_mutex_clear
  12. #define    mutexFree            nb_mutex_free
  13. #define    mutexTryLock        nb_mutex_try_lock
  14. #define    mutexLock            nb_mutex_lock
  15. #define    mutexUnlock            nb_mutex_unlock
  16. #define    mutexName            nb_mutex_name
  17. #define    mutexSetName        nb_mutex_set_name
  18. #define conditionAlloc        condition_alloc
  19. #define conditionFree        condition_free
  20. #define conditionInit        condition_init
  21. #define conditionClear        condition_clear
  22. #define conditionWait        nb_condition_wait
  23. #define conditionBroadcast    condition_broadcast
  24. #define conditionSignal        condition_signal
  25.  
  26. // -------------------------------------------------------------------------------------
  27. // nonBusy mutex structure
  28. typedef struct nb_mutex_s {
  29.   struct mutex        m;
  30.   struct condition    c;
  31.   int                l;
  32. } *nb_mutex_t;
  33.  
  34. // -------------------------------------------------------------------------------------
  35. nb_mutex_t nb_mutex_alloc();
  36. void nb_mutex_init(nb_mutex_t m);
  37. void nb_mutex_clear(nb_mutex_t m);
  38. void nb_mutex_free(nb_mutex_t m);
  39. int nb_mutex_try_lock(nb_mutex_t m);
  40. void nb_mutex_lock(nb_mutex_t m);
  41. void nb_mutex_unlock(nb_mutex_t m);
  42. char *nb_mutex_name(nb_mutex_t m);
  43. void nb_mutex_set_name(nb_mutex_t m, char *name);
  44. void nb_condition_wait(condition_t c, nb_mutex_t n);
  45.  
  46.